﻿<cfscript>
/** 
* ORM CETCourse
* 
* @hint "Hibernate persistenter t_cet_course. 四六级考试成绩课程替代关系" 
* 
*/ 

component 
	displayname="public.service.orm.senate.CETCourse" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="CETCourse" 
	table="t_cet_course"
	{
	
	property type="string" name="CCID" column="cc" fieldtype="id" generator="assigned" hint="四六级课程替代号";
	
	property name="Course" fieldtype="many-to-one" fkcolumn="cid" cfc="Course"  hint="课程";
	property name="CET" fieldtype="many-to-one" fkcolumn="exam_id" cfc="CET" hint="水平测试项目";

	/**
	* @hint "自定义主键规则"
	* 
	* @CET "水平测试项目"
	* @Course "课程"
	*/
	public string function getID( required CET, required Course ) output=false {
		
		var nextID = arguments.CET.getExamID() & "," & arguments.Course.getCourseID();
		
		/* 
			主键生成规则 
			
			替代关系编号15位 4为CET考试代码, 课程号

			Unique: EXAM_ID, CID
		*/
		
		return nextID;
	}
	
}

</cfscript>